﻿@if (ViewData["fileType"].ToString() == "xlsx" || ViewData["fileType"].ToString() == "docx")
{
    @section head{
        @Html.Raw(ViewData["StyleHtmlStr"])
        @*@if (ViewData["fileType"].ToString() == "docx")
        {
<style>
    .word-content {
        position: relative;
        height: 495px;
        width: 100%;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        overflow: auto;
    }
</style>
        }*@
    }
}

<script src="~/lib/jquery/dist/jquery.js"></script>
<script>
    $(function () {
        TimeDown("timer", @ViewData["RemainTime"])
    });

    function TimeDown(id, value) {
        var totalSeconds = parseInt(value); //倒计时的总秒数
        if (totalSeconds <= 0) {
            document.getElementById(id).innerHTML = "已成功完成学习";
        } else {
            var modulo = totalSeconds % (60 * 60 * 24); //取模（余数）
            var hours = Math.floor(modulo / (60 * 60)); //小时数
            modulo = modulo % (60 * 60);
            var minutes = Math.floor(modulo / 60); //分钟
            var seconds = modulo % 60; //秒

            hours = hours.toString().length == 1 ? '0' + hours : hours;
            minutes = minutes.toString().length == 1 ? '0' + minutes : minutes;
            seconds = seconds.toString().length == 1 ? '0' + seconds : seconds;

            //输出到页面
            document.getElementById(id).innerHTML = "距离学习结束" + hours + "时" + minutes + "分" + seconds + "秒";
            //延迟一秒执行自己
            if (hours == "00" && minutes == "00" && parseInt(seconds) - 1 < 0) {

            } else {
                setTimeout(function () {
                    TimeDown(id, value - 1);
                }, 1000)
            }
        }
    }

    //layui.use('flow', function(){
    //    var flow = layui.flow;
    //    //当你执行这样一个方法时，即对页面中的全部带有lay-src的img元素开启了懒加载（当然你也可以指定相关img）
    //    flow.lazyimg();
    //});
</script>


<div class="layui-row">
    <blockquote class="layui-elem-quote layui-bg-green" id="timer">
    </blockquote>
</div>

@if (ViewData["fileType"].ToString() == "ppt")
{
    <div class="layui-carousel" id="test1" style="overflow:auto;">
        <div carousel-item>
            @{
                var picList = ViewData["PicList"] as List<string>;
            }
            @{
                foreach (var item in picList)
                {
                    <div style="overflow:auto;">
                        <img lay-src="@item" width="100%" height="1300px">
                    </div>
                }
            }
        </div>
    </div>
}

@if (ViewData["fileType"].ToString() == "xlsx")
{
    @Html.Raw(ViewData["ContentHtmlStr"]);
}

@if (ViewData["fileType"].ToString() == "docx")
{
    <div class="word-content">
        @Html.Raw(ViewData["ContentHtmlStr"]);
    </div>
}

<script type="text/javascript" src="~/layui/layui.js"></script>
<script>
    layui.use(['carousel','flow'], function () {
        var carousel = layui.carousel,flow = layui.flow;
        //建造实例
        carousel.render({
            elem: '#test1'
            , width: '100%' //设置容器宽度
            , height: '500px'
            , arrow: 'always' //始终显示箭头
            , indicator: 'none'
            , autoplay:'false'
            //,anim: 'updown' //切换动画方式
        });

        flow.lazyimg();
    });
</script>